<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.lmpop.trade.tb_returngoods.Tb_returngoodsInfo" %>
<%@page import="com.lmpop.trade.ti_member.*" %>
<jsp:useBean id="randomId" class="com.lmpop.frame.util.RandomID" scope="page" /> 
<%@page import="com.lmpop.trade.ti_goods.*" %>
<%
	String order_no="",totalmoney="",return_state=""; 
	if(request.getParameter("order_no")!=null ){
		order_no  =request.getParameter("order_no");		
	}
	if(request.getParameter("return_state")!=null ){
		return_state  =request.getParameter("return_state");		
	}
	if(request.getParameter("total_price")!=null ){
		totalmoney  =request.getParameter("total_price");		
	}

	String goods_id="",goods_name=""; 
	if(request.getParameter("goods_id")!=null ){
		goods_id  =request.getParameter("goods_id");
	}
	if(request.getParameter("goods_name")!=null ){
       goods_name=new String(request.getParameter("goods_name").getBytes("ISO8859-1"),"UTF-8");
	}
		

	Tb_returngoodsInfo returnInfo = new Tb_returngoodsInfo();
	List reList = returnInfo.getListByGoodsId(order_no);

	String info_id = randomId.GenTradeId();
	String bpm_id = "7428";

	String reason="",pub_state="",deal_reason="",deal_date="";
	if(reList!=null && reList.size()>0){
		Hashtable rMap = (Hashtable)reList.get(0);
		if(rMap.get("info_id")!=null) info_id = rMap.get("info_id").toString();
		if(rMap.get("reason")!=null) reason = rMap.get("reason").toString();
		if(rMap.get("pub_state")!=null) pub_state = rMap.get("pub_state").toString();
		if(rMap.get("deal_reason")!=null) deal_reason = rMap.get("deal_reason").toString();
		if(rMap.get("deal_date")!=null) deal_date = rMap.get("deal_date").toString();
		if(rMap.get("return_state")!=null) return_state = rMap.get("return_state").toString();
		bpm_id = "3081";
	}

		String cust_id = "";	
	if( session.getAttribute("session_cust_id") != null ){
		cust_id = session.getAttribute("session_cust_id").toString();
	}
	
%>

<script>
	function checkSub(){
			if(document.getElementById('reason').value==''){
				alert('请输入退货理由!');
				document.getElementById('reason').focus();
				return false;
			}
	}
</script>

<div class="f-right ">
    <table width="100%"  cellpadding="0" cellspacing="0" class="table_main">
      <tr>
        <th width="5%" height="40" align="center"><img src="/program/member/index/images/icon1.gif" /></th>
        <th width="75%"><h3>退货申请</h3></th>

      </tr>
    </table>

<!--Content部分开始-->
    <DIV class="focus-area-setTab">
      <DIV class="focus-area-setTab-menu">
        <DIV class="clear"></DIV>
      </DIV>
	  <form action="/doTradeReg.do" method="post" name="addForm" id="addForm" target="_self">
      <DIV class="focus-area-setTab-content">
        <DIV id=con_one_1 >
          <table width="100%" border="0" cellspacing="0"  cellpadding="0" style=" padding-left:15px;">
            <tr>
              <td height="100" valign="top"><table width="80%" border="0" cellspacing="0" cellpadding="0" style="font-size:14px;">
				   <tr>
                    <td  width="120" height="38" class="art_col" >订单号:</td>
                    <td>
					<strong><%=order_no%></strong>
                    </td>
                  </tr>
                  <tr>
                    <td  height="38" class="art_col"  >商品名称:</td>
                    <td><strong><%=goods_name%></strong></td>
                  </tr>
                 
				  
                   <tr>
                    <td height="38" class="art_col">退货理由:</td>
                    <td>
					  <strong><%
						if(pub_state.equals("") || pub_state.equals("0") || pub_state.equals("1")){
					  %>
                      <textarea  name="reason" id="reason" cols="40" rows="5" onkeyup= "value=value.replace(/[^\w\u4E00-\u9FA5]/g,'');"  onbeforepaste= "clearSBC();"><%=reason%></textarea>
					  <%
						}else{
							out.println(reason);
						}
					  %></strong>
					</td>
                  </tr>

				  <%
					if(pub_state.equals("1") || pub_state.equals("2") ){
				  %>
				  <tr>
                    <td height="38" class="art_col">处理状态:</td>
                    <td>
						<strong><%
							if(pub_state.equals("1")) out.println("处理中");
							if(pub_state.equals("2")) out.println("已处理");
						%></strong>
					</td>
                  </tr>
				  <%}%>

				  <%
					if(pub_state.equals("2") || pub_state.equals("1") ){
				  %>
				  <tr>
                    <td height="38" class="art_col">卖家回复:</td>
                    <td>
						<strong><%=deal_reason%></strong>
					</td>
                  </tr>
				  <tr>
                    <td height="38" class="art_col">处理时间:</td>
                    <td>
						<strong><%=deal_date%></strong>
					</td>
                  </tr>
				  <%}%>

				  <tr>
                    <td colspan="2">
                      <table width="100%" border="0" cellspacing="0" cellpadding="0" >
						<tr>
						<td height="50" align="center">
						<input type="hidden" name="order_state" value="<%=return_state%>" />
						<input type="hidden" name="info_id" value="<%=info_id%>" />
						<input type="hidden" name="order_no" value="<%=order_no%>" />
						<input type="hidden" name="cust_id" value="<%=cust_id%>" />
						<input type="hidden" name="goods_id" value="<%=goods_id%>" />
						<input type="hidden" name="goods_name" value="<%=goods_name%>" />
						<input type="hidden" name="pub_state" value="0" />
						<input type="hidden" name="jumpurl" value="/program/member/order/index.jsp" />
						<input type="hidden" name="order_state" value="5" />
						<input type="hidden" name="user_id" value="<%=_user_id%>" />
						<input type="hidden" name="totalmoney" value="<%=totalmoney %>" />
						<input type="hidden" name="return_state" value="<%=return_state %>" />
						<input type="hidden" name="bpm_id" value="<%=bpm_id%>" />
						<input type="submit" name="Submit2" value="确定" class="button2" onclick="return checkSub();">
					   <input type="button" name="Submit2" value="返回" class="button2" onclick="window.location.href='index.jsp?menu_id=<%=menu_id%>';">
						  </td>
						</tr>
					  </table>
					</td>
                  </tr>
                </table>
				</td>
            </tr>
          </table>
          
        </DIV>
      
      </DIV>
	  
	  </form>
    </DIV>
    
</div>